package com.gaofans.vertx.boot.dbutils.session.impl;

import com.gaofans.vertx.boot.dbutils.session.ExecuteOperator;
import com.gaofans.vertx.boot.dbutils.session.FindOperator;
import com.gaofans.vertx.boot.dbutils.session.SqlSession;
import io.vertx.sqlclient.Transaction;

public class TxSqlSession implements SqlSession<Transaction> {

    private final Transaction tx;

    TxSqlSession(Transaction tx) {
        this.tx = tx;
    }

    @Override
    public Transaction client() {
        return tx;
    }

    @Override
    public <T> FindOperator<Transaction, T> find(Class<T> tClass) {
        return new FindOperatorImpl<>(client());
    }

    @Override
    public ExecuteOperator<Transaction> execute(String sql) {
        return new ExecuteOperatorImpl<>(client());
    }

}
